//    Copyright (C) Kherty.  All rights reserved.
using System.Collections.Generic;
using OpenLS.Spreadsheet.Extensibility;

namespace OpenLS.Spreadsheet.StandardAddIn.Database
{
    internal class OrDatabaseCriteria : DatabaseCriteria
    {
        private readonly List<DatabaseCriteria> _criteria = new List<DatabaseCriteria>();

        public List<DatabaseCriteria> Criteria
        {
            get { return _criteria; }
        }

        public override bool Matches(IRange source, int rowIndex)
        {
            foreach (DatabaseCriteria c in Criteria)
                if (c.Matches(source, rowIndex))
                    return true;
            return Criteria.Count == 0;
        }
    }
}